package com.edu.web.servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.edu.entity.GreenUser;
import com.edu.service.impl.GreenUserSericeImpl;
import com.edu.service.impl.UserServiceImpl;

/**
 * Servlet implementation class updeJuanServlet
 */
@WebServlet("/updeJuanServlet")
public class updeJuanServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
   

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		request.setCharacterEncoding("UTF-8");
		 UserServiceImpl userServletImpl=new UserServiceImpl();
			GreenUserSericeImpl greenUserSericeImpl =new GreenUserSericeImpl();
			GreenUser g =new GreenUser();
			String id =request.getParameter("donationId");
			String Remark=request.getParameter("donationRemark");
			String DonationName=request.getParameter("donationName");
			String Country=request.getParameter("donationCountry");
			String donationAddress =request.getParameter("donationAddress"); // 获取有效的 donationAddress 值
			String Email=request.getParameter("donationEmail");
			String Money=request.getParameter("donationMoney");
			String Phone=request.getParameter("donationPhone");
			
			g.setId(Integer.parseInt(id));
			g.setRemark(Remark);
			g.setDonationName(DonationName);
			g.setCountry(Country);
			g.setDonationAddress(donationAddress);
			g.setDonationEmail(Email);
			g.setDonationMoney(Integer.parseInt(Money));
			g.setDonationPhone(Phone);
			boolean num =userServletImpl.UpdetJuan(g);
			request.setAttribute("GreenUser", greenUserSericeImpl.alles());
			request.getRequestDispatcher("manage-Juan.jsp").forward(request, response);
	}

}
